<template>
  <div>
    <div v-html="payhtml" ref="payhtml">
    </div>
  </div>
</template>
<script>
  import orderApi from '@/api/order'
  export default {
    name: 'payOrder',
    data(){
      return{
        payhtml:'',
      }
    },
    created(){
      this.initPage();
    },
    methods: {
      initPage() {
        console.log("aa");
        let params = {
          orderSn: this.$route.query.orderSn,
          amount: this.$route.query.amount,
        }
        orderApi.orderPay(params).then(res => {
          this.payhtml = res.data;
          this.$nextTick(() => {
            this.$refs.payhtml.children[0].submit()
          })
        }).catch(() => {
          this.$notify.error({title:'提示', message:'支付宝接口异常，请稍后再试！'});
        })
      }
    },
  }
</script>
